package com.github.livebase.util.base;

import android.text.TextUtils;

import java.util.function.Supplier;

/**
 * @ClassName Assert
 * @description:
 * @author: biao532
 * @create: 2024-02-01 17:05
 * @Version 1.0
 **/
public class Assert {
    public static void isTrue(boolean expression, String message) {
        if (!expression) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void isNull(Object object, String message) {
        if (object != null) {
            throw new IllegalArgumentException(message);
        }
    }
    public static void notNull(Object object, String message) {
        if (object == null) {
            throw new IllegalArgumentException(message);
        }
    }
    public static void notNull(Object object) {
        notNull(object, "object is null");
    }
    public static void hasLength(String text, String message) {
        if (TextUtils.isEmpty(text)) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void hasText(String text, String message) {
        if (TextUtils.isEmpty(text)) {
            throw new IllegalArgumentException(message);
        }
    }

}
